import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

import Layout from "../views/layout/Layout.vue";
import Detail from "../views/detail/Detail.vue";
Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path:'/',
    redirect:'/home'
  },
  {
    path:'/home',
    component:Layout,
    redirect:'/home/shop',
    children:[
      {
        path:'/home/shop',
        component:()=>import('../views/shop/Shop.vue')
      },
      {
        path:'/home/goods',
        component:()=>import('../views/goods/Goods.vue')
      },
      {
        path:'/home/comment',
        component:()=>import('../views/comment/Comment.vue')
      },
      {
        path:'*',
        component:()=>import('../views/error/Error.vue')
      },
    ],
  },
  {
    path:'/eetail',
    component:Detail
  }
]

const router = new VueRouter({
  routes
})

export default router
